﻿using SqlSugar;
using System.Collections.Generic;

namespace Core.DataAccess.ApiJson
{
    public class ApiJsonDbContext
    {
        public static SqlSugarClient CreateSqlSugarClient(string connectionString)
        {
            return new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = connectionString,
                DbType = DbType.SqlServer,
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute
            });
        }

    }

    public class DbSet<T> : SimpleClient<T> where T : class, new()
    {
        public DbSet(SqlSugarClient context) : base(context)
        {

        }
        public List<T> GetByIds(dynamic[] ids)
        {
            return Context.Queryable<T>().In(ids).ToList(); ;
        }
    }

}
